/**
 * Created by chencheng on 2017/8/24.
 */
let role = require('../../constants/role')
let EnumCommon = require('../../constants/EnumCommon')
let _ = require('lodash')

module.exports = class extends think.Service{
	constructor(){
		super();
		this.cacheService = think.service('cache');

		// 用户model实例
		this.modelUserIns = think.model('user');
		this.modelAccountIns = think.model('account');
	}

    /**
     * 依据account_id获取用户信息
     * @param params
     * @param params.user_status 用户状态
     * @param params.group_id 用户部门
     * @returns {Promise<any>}
     */
    async getUsers(userInfo, params) {
        return await this.modelUserIns.field('account_id,user_id,user_name,user_email,user_phone,user_status,role_id,group_id,created_at,updated_at').select().catch(err => {
            think.logger.error(err);
            return think.isError(err) ? err : new Error(err)
        });
    }

}